from django.http import HttpResponse
from django.views.decorators.csrf import csrf_exempt
import requests

headers = {"Access-Control-Allow-Origin": "*"}


@csrf_exempt
def music_url(request, url, params):
    r_url = url
    r_params = eval(params)
    r = requests.get(url=r_url, params=r_params)
    response = HttpResponse(content=r.content)
    response['Access-Control-Allow-Origin'] = '*'
    return response


@csrf_exempt
def music_direct_url(request, url, params):
    r_url = url + "?" + params
    r = requests.get(url=r_url)
    response = HttpResponse(content=r.content)
    response['Access-Control-Allow-Origin'] = '*'
    return response


@csrf_exempt
def music_detail(request, pk):
    pass
